
  
  <template>
  <el-card class="pageScroll">
    <template #header>
      <div class="card-header flex">
        <div class="flex1">感谢信申领列表</div>
      </div>
    </template>
    <el-form
      :model="queryParams"
      ref="queryFormRef"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="申领时间" prop="time">
        <el-date-picker
          v-model="queryParams.time"
          type="daterange"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button @click="handleQuery">搜索</el-button>
        <el-button @click="resetQuery">重置</el-button>
        <el-button type="success" plain @click="onExport()"> 导出 </el-button>
      </el-form-item>
    </el-form>
    <el-table :data="list" :loading="loading">
      <el-table-column label="序号" align="center" prop="_index" width="60px" />
      <el-table-column
        label="申领感谢信类别"
        align="center"
        prop="thanksLetterClassificationStr"
      >
      </el-table-column>
      <el-table-column
        label="完成任务类别"
        align="center"
        prop="classificationStr"
      >
      </el-table-column>
      <el-table-column label="申领感谢信模板" align="center" prop="templateUrl">
        <template #default="scope">
          <el-image style="width: 100px" :src="scope.row.templateUrl" />
        </template>
      </el-table-column>
      <el-table-column label="积分条件" align="center" prop="integralCondition">
      </el-table-column>
      <el-table-column
        label="申领人完成任务类别累计积分"
        align="center"
        prop="integral"
      >
      </el-table-column>
      <el-table-column label="绿色档案编号" align="center" prop="stuNo">
      </el-table-column>
      <el-table-column label="学生姓名" align="center" prop="stuName">
      </el-table-column>
      <el-table-column label="收件人" align="center" prop="recipients">
      </el-table-column>
      <el-table-column label="收件人手机" align="center" prop="recipientsPhone">
      </el-table-column>
      <el-table-column label="收件地址" align="center" prop="recipientsAddress">
      </el-table-column>
      <el-table-column
        label="申领时间"
        align="center"
        prop="applyTime"
        width="140"
      >
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination :="pagination" class="padding10" />
  </el-card>
</template>
  
<script setup lang="ts">
import API from '@/api/api';
import { CONST_VALUE } from '@/utils/const';
import { useTablePage } from '@/hooks/useTablePage';
import { download } from '@/utils/download';
import dayjs from 'dayjs';
import { transformTime } from '@/utils/transformTime';

const router = useRouter();
const {
  queryParams,
  queryFormRef,
  loading,
  total,
  list,
  handleQuery,
  resetQuery,
  handleDelete,
  pagination,
  exportHandle,
} = useTablePage({
  queryApi: API.thanksLetterController.applylist,
  exportApi: API.thanksLetterController.exportapplylist,
  transformQueryParams: transformTime,
  fileName: '感谢信申领记录',
});

function onExport() {
  exportHandle({});
}
</script>